#pragma once

typedef HFILE (WINAPI *LPOpenFile)(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle);
typedef HANDLE (WINAPI *LPCreateFileA)(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
typedef HANDLE (WINAPI *LPCreateFileW)(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
typedef BOOL (WINAPI *LPCloseHandle)(HANDLE hObject);
typedef BOOL (WINAPI *LPWriteFile)(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
typedef BOOL (WINAPI *LPWriteFileEx)(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
typedef BOOL (WINAPI *LPReadFile)(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
typedef BOOL (WINAPI *LPReadFileEx)(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);

typedef BOOL (WINAPI *LPBuildCommDCBA)(LPCSTR lpDef, LPDCB lpDCB);
typedef BOOL (WINAPI *LPBuildCommDCBW)(LPCWSTR lpDef, LPDCB lpDCB);
typedef BOOL (WINAPI *LPBuildCommDCBAndTimeoutsA)(LPCSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts);
typedef BOOL (WINAPI *LPBuildCommDCBAndTimeoutsW)(LPCWSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts);
typedef BOOL (WINAPI *LPClearCommBreak)(HANDLE hFile);
typedef BOOL (WINAPI *LPClearCommError)(HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpStat);
typedef BOOL (WINAPI *LPEscapeCommFunction)(HANDLE hFile, DWORD dwFunc);
typedef BOOL (WINAPI *LPGetCommConfig)(HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
typedef BOOL (WINAPI *LPGetCommMask)(HANDLE hFile, LPDWORD lpEvtMask);
typedef BOOL (WINAPI *LPGetCommModemStatus)(HANDLE hFile, LPDWORD lpModemStat);
typedef BOOL (WINAPI *LPGetCommProperties)(HANDLE hFile, LPCOMMPROP lpCommProp);
typedef BOOL (WINAPI *LPGetCommState)(HANDLE hFile, LPDCB lpDCB);
typedef BOOL (WINAPI *LPGetCommTimeouts)(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts);
typedef BOOL (WINAPI *LPGetDefaultCommConfig)(LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
typedef BOOL (WINAPI *LPPurgeComm)(HANDLE hFile, DWORD dwFlags);
typedef BOOL (WINAPI *LPSetCommBreak)(HANDLE hFile);
typedef BOOL (WINAPI *LPSetCommConfig)(HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize);
typedef BOOL (WINAPI *LPSetCommMask)(HANDLE hFile, DWORD dwEvtMask);
typedef BOOL (WINAPI *LPSetCommState)(HANDLE hFile, LPDCB lpDCB);
typedef BOOL (WINAPI *LPSetCommTimeouts)(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts);
typedef BOOL (WINAPI *LPSetDefaultCommConfig)(LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize);
typedef BOOL (WINAPI *LPSetupComm)(HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue);
typedef BOOL (WINAPI *LPTransmitCommChar)(HANDLE hFile, char cChar);
typedef BOOL (WINAPI *LPWaitCommEvent)(HANDLE hFile, LPDWORD lpEvtMask, LPOVERLAPPED lpOverlapped);

BOOL InitialiseHooks(HMODULE hCallingModule);
void UninitialiseHooks();
